############################################################猜大小游戏
import random
money = 1000
times = 0
win = 0
rate = 0.0
guess = input("买大买小？：")
while money >= 100 and not guess == "exit":
    sum = 0
    times += 1
    for i in range(3):
        sum += random.randint(1,6)
    if 3 <= sum <= 10 and guess == "小" or 11 <= sum <=18 and guess == "大":
        win += 1
        rate = win / times
        money += 100
        print("恭喜你猜对了，点数为：%d，金豆+100！"%sum)
        print("场次：%d 胜率：%f 金豆：%d"%(times,rate,money))
    else:
        money -= 100
        print("很遗憾猜错了，点数为：%d,金豆-100！"%sum)
        print("场次：%d 胜率：%f 金豆：%d"%(times,rate,money))
    guess = input("买大买小？：")